import { FMVCS } from "../../fgui/fmvc/FMVCS";
import { GlobalEvent } from "../global/Global";

export default class SoundCtrl extends FMVCS.FCtrl {
    static isOn: boolean = true;

    rigisterEventListener(){
        this.on(GlobalEvent.UIListenID.UI_SoundSetting, this.onSoundSetting, this);
    }

    onSoundSetting(bool: boolean){
        this.setSoundSwitch(bool);
    }

    setSoundSwitch(bool: boolean){
        SoundCtrl.isOn = bool;
        fgui.GRoot.inst.volumeScale = bool ? 1 : 0;
    }
}
